import torch.nn.functional as F
import torch
from torch import nn

pred_output = torch.tensor([[[[0.12, 0.36], [0.22, 0.66]], [[0.13, 0.34], [0.52, -0.96]]]])

print("pred_output :",pred_output )
print("pred_output",pred_output.shape)


target = torch.tensor([[[1,0],[0,1]]])

temp1 = F.softmax(pred_output,dim=1)
temp3 = torch.log(temp1)
target = target.long()
loss1 = F.nll_loss(temp3,target)
print("result1: ",loss1)

loss2 = nn.CrossEntropyLoss()
result2 = loss2(pred_output, target)
print('result2: ', result2)
